
<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <title>{php echo $result['config']['title'];}</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
  <link rel="stylesheet" type="text/css" href="{$_G['URL']['YX2020_CSS']}images/rank/css/reset.css?v122">
  <link rel="stylesheet" type="text/css" href="{$_G['URL']['YX2020_CSS']}images/rank/css/style.css?v833">
  <script src="{$_G['URL']['YX2020_CSS']}images/rank/css/screen.js?v24"></script>
  <script src="{$_G['URL']['YX2020_CSS']}js/jquery.js"></script>
    <script src="{$_G['URL']['YX2020_CSS']}js/md5.js?v=2"></script>
 {if $config['weixinh5']==2}
 <script src="{$_G['URL']['YX2020_CSS']}js/vconsole.min.js"></script>
 <script> var vConsole = new VConsole(); </script>
 {/if}
 <script type="text/javascript" src="{$_G['URL']['PUBLIC_JS']}yx2020/swiper_2022.js?v=2"></script>
 </head>
 <body>
     <div style="padding-bottom: 1.85rem;">
        {if !empty($result)}
        {php $config_rank = $result['config'];}
        {php $jishu = $result['jishu'];}
        {if $result['rank_top_imgs']}
        <div class="rank_show_img">
            {loop $result['rank_top_imgs'] $row}
            <div>
                <img src="{php echo $row;}" alt="">
            </div>
            {/loop}
        </div>
        {/if}
        
        <div class="rank_total" style="top:{php echo $config_rank['mystery_boxs_rank_hight'];}px;">
            <div style="background-color: {php echo ($config_rank['tuanrank_color2'] ? $config_rank['tuanrank_color2'] : '');};">
                {php echo $config_rank['mystery_boxs_rank_tips'];}
            </div>
        </div>
        <div class="rank_box" style="background-color: {php echo ($config_rank[tuanrank_color] ? $config_rank[tuanrank_color] : '');};">
            {if $config_rank['isworker']}
            <ul class="rank_isWorker">
                {loop $result['ranklist'] $index $rank}
                {if $config_rank['rank_order'] == 1} 
                <li>
                    <div class="rank_user">
                        <span class="rank_tag" style="background-color: {php echo ($config_rank['tuanrank_color'] && $index>2 ? $config_rank['tuanrank_color'] : '');};">
                            {if $index >2}
                                {if $index < 9 }
                                    0{php echo $index+1;}
                                {else} 
                                    {php echo $index+1;} 
                                {/if}
                            {/if}
                        </span>
                        <img src="{php echo $rank['avatar'];}">
                    </div>
                    <div class="rank_txt">
                        <h2 style="color: {php echo ($config_rank['tuanrank_color'] ? $config_rank['tuanrank_color'] : '');};">团长:{php echo $rank['username'];}</h2>
                        <p style="color: {php echo ($config_rank['tuanrank_color'] ? $config_rank['tuanrank_color'] : '');};">本团已有<span>{php echo $rank['tuannum'];}名</span>成员</p>
                        {if $rank['worker']} 
                        <p style="color: {php echo ($config_rank['tuanrank_color'] ? $config_rank['tuanrank_color'] : '');};">负责：{php echo $rank['worker'];}</p>
                        {/if}
                    </div>
                    <div class="rank_phone">
                        <p style="color: {php echo ($config_rank['tuanrank_color'] ? $config_rank['tuanrank_color'] : '');};">{php echo $rank['mobile'];}</p>
                        <a href="tel:{php echo $rank['mobile'];}"><img style="background-color: {php echo ($config_rank['tuanrank_color'] ? $config_rank['tuanrank_color'] : '');};" src="{$_G['URL']['YX2020_CSS']}images/rank/phone.png"></a>
                    </div>
                </li>
                {elseif $config_rank['rank_order'] == 2}
                <li>
                    <div class="rank_user">
                        <span class="rank_tag" style="background-color: {php echo ($config_rank[tuanrank_color] && $index>2 ? $config_rank[tuanrank_color] : '');};">
                            {if $index >2}
                                {if $index < 9 }
                                    0{php echo $index+1;}
                                {else} 
                                    {php echo $index+1;} 
                                {/if}
                            {/if}
                        </span>
                        <img src="{php echo $rank['avatar'];}">
                    </div>
                    <div class="rank_txt">
                        <h2 style="color: {php echo ($config_rank[tuanrank_color] ? $config_rank[tuanrank_color] : '');};">昵称:{php echo $rank['nickname'];}</h2>
                    </div>
                    <div class="rank_peo" style="background-color: {php echo ($config_rank[tuanrank_color2] ? $config_rank[tuanrank_color2] : '');};">
                        {php echo $rank['friendnum'];}人助力
                    </div>
                </li>
                {elseif $config_rank['rank_order'] == 3 || $config_rank['rank_order'] == 4} 
                <li>
                    <div class="rank_user">
                        <span class="rank_tag" style="background-color: {php echo ($config_rank['tuanrank_color'] && $index>2 ? $config_rank['tuanrank_color'] : '');};">
                            {if $index >2}
                                {if $index < 9 }
                                    0{php echo $index+1;}
                                {else} 
                                    {php echo $index+1;} 
                                {/if}
                            {/if}
                        </span>
                        <img src="{php echo $rank['avatar'];}">
                    </div>
                    <div class="rank_txt">
                        <h2 style="color: {php echo ($config_rank['tuanrank_color'] ? $config_rank['tuanrank_color'] : '');};">昵称:{php echo $rank['nickname'];}</h2>
                    </div>
                    <div class="rank_peo" style="background-color: {php echo ($config_rank['tuanrank_color2'] ? $config_rank['tuanrank_color2'] : '');};">
                        人数{php echo $rank['num'];}人
                    </div>
                </li>
                {/if}
                {/loop}
            </ul>
            {else} 
            <dl class="rank_notWorker">
                {loop $result['ranklist'] $index $rank}
                {if $config_rank['rank_order'] == 1} 
                <dt>
                    <div class="rank_Tag" style="background-color: {php echo ($config_rank['tuanrank_color'] && $index>2 ? $config_rank['tuanrank_color'] : '');};">
                        {if $index <= 2}
                        <img src="{$_G['URL']['YX2020_CSS']}images/rank/rank{php echo $index + 1;}.png">
                        {else}
                        {if $index < 9 }
                            0{php echo $index+1;}
                        {else} 
                            {php echo $index+1;} 
                        {/if}
                        {/if}
                    </div>
                    <div class="rank_user">
                        <img src="{php echo $rank['avatar'];}">
                    </div>
                    <div class="rank_txt">
                        <h2 style="color: {php echo ($config_rank['tuanrank_color'] ? $config_rank['tuanrank_color'] : '');};">团长：{php echo $rank['username'];}</h2>
                        <p style="color: {php echo ($config_rank['tuanrank_color'] ? $config_rank['tuanrank_color'] : '');};">电话：<a href="tel:{php echo $rank['mobile'];}" style="color: {php echo ($config_rank['tuanrank_color'] ? $config_rank['tuanrank_color'] : '');};">{php echo $rank['mobile'];}</a></p>
                    </div>
                    <div class="rank_peo" style="background-color: {php echo ($config_rank['tuanrank_color2'] ? $config_rank['tuanrank_color2'] : '');};">
                        团员{php echo $rank['tuannum'];}名
                    </div>
                </dt>
                {elseif $config_rank['rank_order'] == 2}
                <dt>
                    <div class="rank_Tag" style="background-color: {php echo ($config_rank['tuanrank_color'] && $index>2 ? $config_rank['tuanrank_color'] : '');};">
                        {if $index <= 2}
                        <img src="{$_G['URL']['YX2020_CSS']}images/rank/rank{php echo $index + 1;}.png">
                        {else}
                        {if $index < 9 }
                            0{php echo $index+1;}
                        {else} 
                            {php echo $index+1;} 
                        {/if}
                        {/if}
                    </div>
                    <div class="rank_user">
                        <img src="{php echo $rank['avatar'];}">
                    </div>
                    <div class="rank_txt">
                        <h2 style="color: {php echo ($config_rank['tuanrank_color'] ? $config_rank['tuanrank_color'] : '');};">昵称:{php echo $rank['nickname'];}</h2>
                    </div>
                    <div class="rank_peo" style="background-color: {php echo ($config_rank['tuanrank_color2'] ? $config_rank['tuanrank_color2'] : '');};">
                        {php echo $rank['friendnum'];}人助力
                    </div>
                </dt>
                {elseif $config_rank['rank_order'] == 3 || $config_rank['rank_order'] == 4}
                <dt>
                    <div class="rank_Tag" style="background-color: {php echo ($config_rank['tuanrank_color'] && $index>2 ? $config_rank['tuanrank_color'] : '');};">
                        {if $index <= 2}
                        <img src="{$_G['URL']['YX2020_CSS']}images/rank/rank{php echo $index + 1;}.png">
                        {else}
                        {if $index < 9 }
                            0{php echo $index+1;}
                        {else} 
                            {php echo $index+1;} 
                        {/if}
                        {/if}
                    </div>
                    <div class="rank_user">
                        <img src="{php echo $rank['avatar'];}">
                    </div>
                    <div class="rank_txt">
                        <h2 style="color: {php echo ($config_rank['tuanrank_color'] ? $config_rank['tuanrank_color'] : '');};">昵称:{php echo $rank['nickname'];}</h2>
                    </div>
                    <div class="rank_peo" style="background-color: {php echo ($config_rank['tuanrank_color2'] ? $config_rank['tuanrank_color2'] : '');};">
                        人数{php echo $rank['num'];}人
                    </div>
                </dt>
                {/if}
                {/loop}
                
            </dl>
            {/if}
            
            {if !$result['rank_last']}
            <a class="rank_checkmore load_more" style="background-color: {php echo ($config_rank['tuanrank_color2'] ? $config_rank['tuanrank_color2'] : '');};">点击查看更多</a>
            {else}
            <a class="rank_checkmore" style="background-color: {php echo ($config_rank['tuanrank_color2'] ? $config_rank['tuanrank_color2'] : '');};">{php echo $result['last_tips'];}</a>
            {/if}
        </div>
        {if $result['rank_bottom_imgs']}
        <div class="rank_show_img">
            {loop $result['rank_bottom_imgs'] $row}
            <div>
                <img src="{php echo $row;}" alt="">
            </div>
            {/loop}
        </div>
        {/if}
        <a href="tel:{php echo $jishu['mobile'];}" class="jishu">
            {if $jishu['img']}
            {php echo $jishu['txt2'][0];}:<img src="{php echo $jishu['img'];}" style="display:inline;vertical-align: middle;width:17px;" alt="">{php echo $jishu['txt2'][1];}
            {else} 
            {php echo $jishu['txt'];}
            {/if}
        </a>
        <div class="rank_bottom" style="z-index: 10;">
            <a class="rank_back" style="width: 40%;font-size: .36rem;background-color: {php echo ($config_rank['tuanrank_color2'] ? $config_rank['tuanrank_color2'] : '');};">返回</a>
            <div class="rank_num" style="width: 60%;background-color: {php echo ($config_rank['tuanrank_color'] ? $config_rank['tuanrank_color'] : '');};">
                我的排行<span>No.{php echo $config_rank['rank'];}</span>
            </div>
        </div>
        <div id="mcover7" onclick="document.getElementById('mcover7').style.display='';">
            <img src="https://css2020.yixuan.net/2019css/default/images/fenxiao07.png" />
        </div>
    {/if}
</div>
    
	
 </body>
</html>
<script>
    let page = 1;
    $('a.rank_back').click(function() {
        window.history.back();
    });
    $('a.invent_friend').click(function(){
        // alert('邀请好友');
        $('#mcover7').css('display', 'block');
    });
    $('a.load_more').click(function() {
        const that = $(this);
        $.ajax({
            url:'/{php echo createMobileUrl("ranksingle",array("themeid"=>$_P["themeid"]));}',
            dataType:'json',
            method:'post',
            data:{
                page: page+1,
                showconfig:1
            },
            success:function (e) {
                let message = e.message;
                let config = message.config;
                let color = config.tuanrank_color
                let color2 = config.tuanrank_color2
                page++;
                if (message.rank_last) {
                    that.unbind('click');
                    that.html(message.last_tips);
                } 
                if(message.ranklist.length > 0) {
                    message.ranklist.forEach(item => {
                        if(config.isworker) {
                            const ul = $('ul.rank_isWorker');
                            const lis = $('ul.rank_isWorker li')
                            const length = lis.length;
                            switch(config.rank_order) {
                                case 1: 
                                    const li1 = `<li>
                                                    <div class="rank_user">
                                                        <span class="rank_tag" style="${color && length > 2? `background-color: ${color};`:''}">
                                                            ${length >2 ? (length < 9 ? `0${length+1}`: length+1) : ''}
                                                        </span>
                                                        <img src="${item.avatar}">
                                                    </div>
                                                    <div class="rank_txt">
                                                        <h2 style="${color? `color: ${color};`:''}">团长:${item.username}</h2>
                                                        <p style="${color? `color: ${color};`:''}">本团已有<span>${item.tuannum}名</span>成员</p>
                                                        ${ item.worker ? `<p style="${color? `color: ${color};`:''}">负责：${item.worker}</p>` : '' }
                                                    </div>
                                                    <div class="rank_phone">
                                                        <p style="${color? `color: ${color};`:''}">${item.mobile}</p>
                                                        <a href="tel:${item.mobile}"><img style="${color? `background-color: ${color};`:''}" src="https://css2020.yixuan.net/2020css/yx2020/images/rank/phone.png"></a>
                                                    </div>
                                                </li>`;
                                    ul.append(li1);
                                    break;
                                case 2: 
                                    const li2 = `<li>
                                                    <div class="rank_user">
                                                        <span class="rank_tag" style="${color && length > 2? `background-color: ${color};`:''}">
                                                            ${length >2 ? (length < 9 ? `0${length+1}`: length+1) : ''}
                                                        </span>
                                                        <img src="${item.avatar}">
                                                    </div>
                                                    <div class="rank_txt">
                                                        <h2 style="${color? `color: ${color};`:''}">昵称:${item.nickname}</h2>
                                                    </div>
                                                    <div class="rank_peo" style="${color2? `background-color: ${color2};`:''}">
                                                        ${item.friendnum}人助力
                                                    </div>
                                                </li>`;
                                    ul.append(li2);
                                    break;
                                case 3 || 4: 
                                    const li34 = `<li>
                                                    <div class="rank_user">
                                                        <span class="rank_tag" style="${color && length > 2? `background-color: ${color};`:''}">
                                                            ${length >2 ? (length < 9 ? `0${length+1}`: length+1) : ''}
                                                        </span>
                                                        <img src="${item.avatar}">
                                                    </div>
                                                    <div class="rank_txt">
                                                        <h2 style="${color? `color: ${color};`:''}">昵称:${item.nickname}</h2>
                                                    </div>
                                                    <div class="rank_peo" style="${color2? `background-color: ${color2};`:''}">
                                                        人数${item.num}人
                                                    </div>
                                                </li>`;
                                    ul.append(li34);
                                    break;
                                default:
                                    break;
                                    
                            }
                        } else {
                            const dl = $('dl.rank_notWorker');
                            const dts = $('dl.rank_notWorker dt')
                            const length = dts.length;
                            switch(config.rank_order) {
                                case 1: 
                                    const dt1 = `<dt>
                                                    <div class="rank_Tag" style="${color && length > 2? `background-color: ${color};`:''}">
                                                        ${length < 2 ? `<img src="https://css2020.yixuan.net/2020css/yx2020/images/rank/rank${length + 1}.png">`: (length < 9 ? `0${length+1}`: length+1)}
                                                    </div>
                                                    <div class="rank_user">
                                                        <img src="${item.avatar}">
                                                    </div>
                                                    <div class="rank_txt">
                                                        <h2 style="${color? `color: ${color};`:''}">团长：${item.username}</h2>
                                                        <p style="${color? `color: ${color};`:''}">电话：<a href="tel:${item.mobile}" style="${color? `color: ${color};`:''}">${item.mobile}</a></p>
                                                    </div>
                                                    <div class="rank_peo" style="${color2? `background-color: ${color2};`:''}">
                                                        团员${item.tuannum}名
                                                    </div>
                                                </dt>`;
                                    dl.append(dt1);
                                    break;
                                case 2: 
                                    const dt2 = `<dt>
                                                    <div class="rank_Tag" style="${color && length > 2? `background-color: ${color};`:''}">
                                                        ${length < 2 ? `<img src="https://css2020.yixuan.net/2020css/yx2020/images/rank/rank${length + 1}.png">`: (length < 9 ? `0${length+1}`: length+1)}
                                                    </div>
                                                    <div class="rank_user">
                                                        <img src="${item.avatar}">
                                                    </div>
                                                    <div class="rank_txt">
                                                        <h2 style="${color? `color: ${color};`:''}">昵称:${item.nickname}</h2>
                                                    </div>
                                                    <div class="rank_peo" style="${color2? `background-color: ${color2};`:''}">
                                                        ${item.friendnum}人助力
                                                    </div>
                                                </dt>`;
                                    dl.append(dt2);
                                    break;
                                case 3: 
                                    const dt3 = `<dt>
                                                    <div class="rank_Tag" style="${color && length > 2? `background-color: ${color};`:''}">
                                                        ${length < 2 ? `<img src="https://css2020.yixuan.net/2020css/yx2020/images/rank/rank${length + 1}.png">`: (length < 9 ? `0${length+1}`: length+1)}
                                                    </div>
                                                    <div class="rank_user">
                                                        <img src="${item.avatar}">
                                                    </div>
                                                    <div class="rank_txt">
                                                        <h2 style="${color? `color: ${color};`:''}">昵称:${item.nickname}</h2>
                                                    </div>
                                                    <div class="rank_peo" style="${color2? `background-color: ${color2};`:''}">
                                                        人数${item.num}人
                                                    </div>
                                                </dt>`;
                                    dl.append(dt3);
                                    break;
                                case 4: 
                                    const dt4 = `<dt>
                                                    <div class="rank_Tag" style="${color && length > 2? `background-color: ${color};`:''}">
                                                        ${length < 2 ? `<img src="https://css2020.yixuan.net/2020css/yx2020/images/rank/rank${length + 1}.png">`: (length < 9 ? `0${length+1}`: length+1)}
                                                    </div>
                                                    <div class="rank_user">
                                                        <img src="${item.avatar}">
                                                    </div>
                                                    <div class="rank_txt">
                                                        <h2 style="${color? `color: ${color};`:''}">昵称:${item.nickname}</h2>
                                                    </div>
                                                    <div class="rank_peo" style="${color2? `background-color: ${color2};`:''}">
                                                        人数${item.num}人
                                                    </div>
                                                </dt>`;
                                    dl.append(dt4);
                                    break;
                                default: 
                                    break;

                            }
                        }
                    })
                }
                    
            },
            fail:function (err) {
                console.log(err)
            }
        })
    })
</script>


<script type="text/javascript" src="http://res2.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
<script>
    function onBridgeReady() {
        WeixinJSBridge.call('hideOptionMenu');
    }

    if (typeof WeixinJSBridge == "undefined") {
        if (document.addEventListener) {
            document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
        } else if (document.attachEvent) {
            document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
            document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
        }
    } else {
        onBridgeReady();
    }
</script>